package com.ssy.lingxi.order.repository;

import com.ssy.lingxi.order.entity.OrderPurchaseProcessDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 采购流程规则配置Jpa仓库
 * @author 万宁
 * @version 2.0.0
 * @date 2021-07-24
 */
@Repository
public interface OrderPurchaseProcessRepository extends JpaRepository<OrderPurchaseProcessDO, Long>, JpaSpecificationExecutor<OrderPurchaseProcessDO>, QuerydslPredicateExecutor<OrderPurchaseProcessDO> {

    List<OrderPurchaseProcessDO> findByMemberIdAndRoleIdAndProcessType(Long memberId, Long roleId, Integer processType);

    List<OrderPurchaseProcessDO> findByMemberIdAndRoleIdAndProcessTypeAndIdNot(Long memberId, Long roleId, Integer processType, Long id);

    List<OrderPurchaseProcessDO> findByMemberIdAndRoleIdAndProcessTypeAndStatus(Long memberId, Long roleId, Integer processType, Integer status);
}
